﻿Public Module DateExtensions
    ''' <summary>
    ''' Returns the day of week in ISO standard (monday=0,tuesday=1,...,sunday=6
    ''' </summary>
    ''' <param name="date"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    <System.Runtime.CompilerServices.Extension()> _
    Public Function DayOfWeekIso(ByVal [date] As Date) As Integer
        Select Case [date].DayOfWeek
            Case DayOfWeek.Sunday
                Return 6
            Case Else
                Return CInt([date].DayOfWeek) - 1
        End Select
    End Function

End Module
